package com.ruoyi.equip.vert.service.impl;

import com.ruoyi.common.utils.spring.SpringUtils;
import com.ruoyi.equip.domain.cache.DeviceTagCache;
import com.ruoyi.equip.mapper.DeviceInfoMapper;
import com.ruoyi.equip.util.CacheUtils;
import com.ruoyi.equip.util.HeartCacheUtils;
import com.ruoyi.equip.vert.domain.TcpParserEntity;
import com.ruoyi.equip.vert.service.TransferStrategy;
import lombok.extern.slf4j.Slf4j;

import javax.annotation.Resource;
import java.util.HashMap;

@Slf4j
public class HeartTransfer implements TransferStrategy {

    public static HashMap<String,Boolean> isRetryMap=new HashMap<>();

    ReqTagNumTransfer reqTagNumTransfer= SpringUtils.getBean(ReqTagNumTransfer.class);
    @Override
    public void transfer(TcpParserEntity tcpParserEntity) {
        String readerId = tcpParserEntity.getReaderId();
        log.info("heart");
        DeviceTagCache deviceTagCache = CacheUtils.getDeviceTagCache(readerId);
        String productKey = deviceTagCache.getProductKey();

        // 心跳缓存
        HeartCacheUtils.setOnline(readerId,productKey);
    }
}
